home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 March / EnigmA AMIGA RUN 05 (1996)(G.R. Edizioni)(IT)[!][issue 1996-03][Skylink CD IV].iso / earcd / patches / pgs3h1.lha / 3.0hUpdate / Macros.LHA / BMEcmdshell.rexx next >
OS/2 REXX Batch file  |  1995-06-12  |  992b  |  56 lines

  1. /* $VER: Command Shell 1.1 (12.06.95) */
  2.  
  3.  
  4. options results
  5. options failat 100
  6.  
  7. open('console', 'CON:0/9999/9999/50/BME/SCREEN BME', 'RW')
  8. writeln('console', 'Enter commands, "Q" to exit, "?" for help.')
  9.  
  10. address BME
  11.  
  12. /* loop until user exits */
  13. do forever
  14.  
  15.     /* get command string from user */
  16.     writech('console','CMD> ')
  17.     cmd=readln('console')
  18.  
  19.     select
  20.  
  21.         /* time to quit? */
  22.         when (upper(cmd) = "Q") then do
  23.             leave
  24.         end
  25.  
  26.         /* need some help? */
  27.         when (cmd = "?") then do
  28.             writeln('console', 'Enter "Q" to exit command shell.')
  29.         end
  30.  
  31.         /* do nothing on empty lines */
  32.         when (cmd = "") then do
  33.             nop
  34.         end
  35.  
  36.         /* whatsinaline */
  37.         otherwise do
  38.             /* execute the command string */
  39.             cmd
  40.  
  41.             /* if ok show the result, if any */
  42.             if (RC = 0) then do
  43.                 if result ~= "RESULT" then writeln('console', result)
  44.                 if (upper(cmd) = "QUIT") then leave
  45.             end
  46.  
  47.             else do
  48.                 /* ERROR!!!!   get fault string from MCEd */
  49.                 writeln('console', '*** Error');
  50.             end
  51.         end
  52.     end
  53. end
  54.  
  55. exit(0)
  56.